#include "statement.h"

void guess_number ()
{   
    while (1)
    {
        int p;
        printf("1.开始游戏\n2.退出\n");
        scanf("%d", &p);
        while (1)
        {
        if (p==1)
        {
            break;
        }
        else if (p==2)
        {
            return ;
        }
        else {printf("未识别到有效数字，请重新输入\n");}
        getchar();
        }
        
        int RNG;
        srand(time(NULL));
        RNG = rand() %100 +1;
        int guess=0;
        while (guess != RNG)
        {
        printf("请输入你猜的数：");
        scanf("%d", &guess);
        if ( guess < RNG )
        {
            printf("你猜小了\n");
        }
        else if (guess > RNG )
        {
            printf("你猜大了\n");
        }
        }
        printf("你猜对了\n");
    }
}